import { randomRange, arrIdentical,mbTransform } from '@/utils'
const columnCurrent = [
  {
    title: '序号',
    dataIndex: 'index',
    key: 'index',
    fixed: "left",
    width: 80
  },
  {
    title: '任务ID',
    dataIndex: 'taskId',
    key: 'taskId',
    width: 120,
    customCell:()=>{
      return {
        style:{
          maxWidth: 120,
          overflow: 'hidden',
          whiteSpace: 'nowrap',
          textOverflow: 'ellipsis',
          cursor: 'pointer'
        }
      }
    }
  },
  {
    title: '打印人',
    dataIndex: 'printUserName',
    key: 'printUserName',
    width: 120
  },
  {
    title: '文件名',
    dataIndex: 'fileName',
    key: 'fileName',
    width: 120
  },
  {
    title: '大小',
    dataIndex: 'fileStrSize',
    key: 'fileStrSize',
    width: 120,
    customRender({text, record, index, column}) {
      return mbTransform(record.fileSize)
    }
  },
  {
    title: '页数',
    dataIndex: 'printNum',
    key: 'printNum',
    width: 120
  },
  {
    title: '状态',
    dataIndex: 'taskStatusName',
    key: 'taskStatusName',
    width: 120
  },
  {
    title: '开始时间',
    dataIndex: 'printTime',
    key: 'printTime',
    width: 120
  },
];
const columnhistory = [
  {
    title: '序号',
    dataIndex: 'index',
    key: 'index',
    fixed: "left",
    width: 80
  },
  {
    title: '任务ID',
    dataIndex: 'taskId',
    key: 'taskId',
    width: 120,
    customCell:()=>{
      return {
        style:{
          maxWidth: 120,
          overflow: 'hidden',
          whiteSpace: 'nowrap',
          textOverflow: 'ellipsis',
          cursor: 'pointer'
        }
      }
    }
  },
  {
    title: '打印人',
    dataIndex: 'printUserName',
    key: 'printUserName',
    width: 120
  },
  {
    title: '文件名',
    dataIndex: 'fileName',
    key: 'fileName',
    width: 120
  },
  {
    title: '大小',
    dataIndex: 'fileStrSize',
    key: 'fileStrSize',
    width: 120,
    customRender({text, record, index, column}) {
      return mbTransform(record.fileSize)
    }
  },
  {
    title: '页数',
    dataIndex: 'printNum',
    key: 'printNum',
    width: 120
  },
  {
    title: '状态',
    dataIndex: 'taskStatusName',
    key: 'taskStatusName',
    width: 120
  },
  {
    title: '开始时间',
    dataIndex: 'printTime',
    key: 'printTime',
    width: 150
  },

];
const rules = {
  printerName: [{ required: true, message: '请选择打印机', trigger: 'change' }],
  isInternetPrint: [{ required: true, message: '请选择启用/禁用', trigger: 'change' }],
  printerPosition: [
    { required: true, message: '请输入打印机位置', trigger: 'blur' },
    { min: 1, max: 200, message: '限制两百个字符', trigger: 'blur' },
  ],
  printerIcon: [{ required: true, message: '请选择打印机图标', trigger: 'blur' }],
  accessUnitName: [{ required: true, message: '请添加使用范围', trigger: 'change' }],
  remark: [{ required: true, message: '请输入备注', trigger: 'blur' },
  { min: 1, max: 200, message: '限制两百个字符', trigger: 'blur' },],
};
export {
  columnCurrent,
  columnhistory,
  rules
}